home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
stat.zip
/
DYNAMIC.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-07-21
|
970b
|
37 lines
program dynamic;
uses
crt,stat;
const
num = 2000; { number of data points }
var
x : single_array_pointer; { point to the dynamic array }
j : word;
sd : single;
save,save2,save3 : longint;
begin
{ clear screen }
clrscr;
gotoxy(20,5);
writeln('DYNAMIC ARRAY CREATION AND DELETION EXAMPLE');
{ save status of heap }
save := maxavail;
{ create the dynamic x array and save memory used }
create_single_array(num,x);
save2 := maxavail;
{ should be 8000 bytes used }
gotoxy(1,10);
writeln('actual and estimated ', (save - save2 ):10, num*sizeof(single):10,
' bytes used in x array');
delete_single_array(num,x);
save3 := maxavail;
writeln((save3 - save2 ):10,' bytes recovered from heap');
{ answers below should be the same }
writeln('Before use and after example heap size',save:10,save3:10);
end.